package com.ruoyi.framework.config.redis;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * redis 事件监听器配置
 *
 * @author xueyu
 */
@Slf4j
@Configuration
public class RedisListenerConfig {

    /**
     * 注册Redis消息侦听器提供异步行为的容器
     *
     * @param redisConnectionFactory Redis消息侦听器提供异步行为的容器
     * @return {@linkplain  RedisMessageListenerContainer}
     */
    @Bean
    public RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory redisConnectionFactory) {
        log.info("配置Redis消息侦听器。。。");
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        container.setConnectionFactory(redisConnectionFactory);
        return container;
    }


}
